-- GET_VARY_DESC

-- 获取实时变化的技能描述
return function(target, desc, skillId)
    -- 藤蔓护盾
    if skillId == 2206 then
        -- 魔法抗性
        local props = PropM.fetchProps(target, "resist");
        for _, prop in pairs(props) do
            if prop[2] == "magic" then
                desc = string.gsub(desc, "{magic}", prop[3] / 10);
            end
        end

        -- 反射伤害
        props = PropM.fetchProps(target, "reflex_damage");
        for _, prop in pairs(props) do
            desc = string.gsub(desc, "{reflex}", prop[3] / 10);
        end
    -- 恶徒光环
    elseif skillId == 2232 then
        -- 魔法/物理抗性
        local props = PropM.fetchProps(target, "resist");
        for _, prop in pairs(props) do
            -- 降到0了就不显示了
            if prop[3] <= 0 then
                return;
            end

            if prop[2] == "magic" then
                desc = string.gsub(desc, "{magic}", prop[3] / 10);
            elseif prop[2] == "attack" then
                desc = string.gsub(desc, "{attack}", prop[3] / 10);
            end
        end
    -- 治愈光环
    elseif skillId == 2261 then
        -- 回合回血
        local props = PropM.fetchProps(target, "round_self_recover4");
        if #props == 0 then
            return;
        end

        local max = target:getMaxHp();
        local cur = target:getHp();
        local value = math.floor(math.pow(DungeonM.currentLayer() + 10, 3) / 1750);

        desc = string.gsub(desc, "{hp}", value);
    elseif skillId == 2265 then
        -- 回合掉血
        local props = PropM.fetchProps(target, "round_bleed");
        if #props == 0 then
            return;
        end

        local value = props[1][3];
        local round = target.dbase:query("valid_round") or CombatM.getRound();
        local maxHp = ME.user:getMaxHp();

        -- 开始处于黑暗形态的回合
        local startDarkRound = target.dbase:query("start_dark_round") or 0;

        -- 回合差
        local difRound = round - startDarkRound;

        local damage = FormulaM.invoke("CALA_ROUND_BLEED_VALUE", difRound, maxHp, value);
        desc = string.gsub(desc, "{hp}", damage);
    elseif skillId == 2329 then
        -- 基础伤害
        local value = 90;

        -- 增加效果
        local prop = PropM.combine(target, "increase_skill_effect", skillId);
        value = (value + prop[3]) / 10;

        desc = string.gsub(desc, "{rate}", value);
    elseif skillId == 2331 then
        -- 没有护盾能量了就隐藏
        local prop = PropM.combine(target, "special_shield", OBJECT_TYPE_AVALON_CANNON);
        if prop[3] <= 0 then
            return nil;
        end
    elseif skillId == 2346 then
        -- 守护者飞艇显示
        local prop = PropM.combine(target, "defender_ship", 1);
        desc = PropM.getPropDesc(prop);
    end

    return desc;
end
